package com.cskaoyan.service.system;

import com.cskaoyan.mapper.SystemConfigMapper;
import com.cskaoyan.vo.config.ConfigExpressVo;
import com.cskaoyan.vo.config.ConfigMallVo;
import com.cskaoyan.vo.config.ConfigOrderVo;
import com.cskaoyan.vo.config.ConfigWxVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * description:
 * author:houzhitao@139.com
 */
@Service
public class ConfigServiceImpl implements ConfigService {

    @Autowired
    SystemConfigMapper systemConfigMapper;

    @Override
    public ConfigMallVo queryMallConfig() {
        ConfigMallVo configMallVo = new ConfigMallVo();
        String keyValue=null;
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_mall_name");
        configMallVo.setCskaoyanmall_mall_name(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_mall_qq");
        configMallVo.setCskaoyanmall_mall_qq(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_mall_phone");
        configMallVo.setCskaoyanmall_mall_phone(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_mall_address");
        configMallVo.setCskaoyanmall_mall_address(keyValue);
        return configMallVo;
    }

    @Override
    public ConfigExpressVo queryExpressConfig() {
        ConfigExpressVo configExpressVo = new ConfigExpressVo();
        String keyValue=null;
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_express_freight_value");
        configExpressVo.setCskaoyanmall_express_freight_value(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_express_freight_min");
        configExpressVo.setCskaoyanmall_express_freight_min(keyValue);
        return configExpressVo;
    }

    @Override
    public ConfigOrderVo queryOrderConfig() {
        ConfigOrderVo configOrderVo = new ConfigOrderVo();
        String keyValue=null;
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_order_unconfirm");
        configOrderVo.setCskaoyanmall_order_unconfirm(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_order_unpaid");
        configOrderVo.setCskaoyanmall_order_unpaid(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_order_comment");
        configOrderVo.setCskaoyanmall_order_comment(keyValue);
        return configOrderVo;
    }

    @Override
    public ConfigWxVo queryWxConfig() {
        ConfigWxVo configWxVo = new ConfigWxVo();
        String keyValue=null;
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_share");
        configWxVo.setCskaoyanmall_wx_share(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_index_brand");
        configWxVo.setCskaoyanmall_wx_index_brand(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_index_topic");
        configWxVo.setCskaoyanmall_wx_index_topic(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_index_hot");
        configWxVo.setCskaoyanmall_wx_index_hot(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_catlog_goods");
        configWxVo.setCskaoyanmall_wx_catlog_goods(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_catlog_list");
        configWxVo.setCskaoyanmall_wx_catlog_list(keyValue);
        keyValue = systemConfigMapper.selectByKeyName("cskaoyan_mall_wx_index_new");
        configWxVo.setCskaoyanmall_wx_index_new(keyValue);
        return configWxVo;
    }
}
